<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./jquery-3.7.1.js"></script>
    <script>
        // 原生ajax
        var xmlHttpRequest = new XMLHttpRequest();
        
        // 设置回调函数  callBack 回调
        xmlHttpRequest.onreadystatechange = doit;

        // 请求后台的地址  api接口
        var url = "https://gitee.com/check";

        // 创建发送的数据
        // do=user_username&val=ztlb
        var data = {do:"user_username",val:"ztlb"};

        // 打开请求地址
        xmlHttpRequest.open("POST", url, true);

        // 发送请求并传递数据
        xmlHttpRequest.send(data);

        function doit(){
            if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) {
                var d = xmlHttpRequest.responseText;
                console.log(d);
            }
        }

        $(function(){
            $.post("https://gitee.com/check",{do:"user_username",val:"ztlb"},function(d){
                console.log(d)
            },"json");
        })
    </script>
</body>
</html>